# -*- coding: utf-8 -*-

import json
import pymysql

class GovernmentprojectPipeline(object):
    def open_spider(self, spider):
        self.fp = open('content.txt', 'w', encoding='utf-8')

    def process_item(self, item, spider):
        obj = dict(item)
        string = json.dumps(obj, ensure_ascii=False)
        self.fp.write(string + '\n')
        return item

    def close_spider(self, spider):
        self.fp.close()

